<template>
  <div class="wrap">
    <div class="col-title">
      调度日志
    </div>

    <a-table
      ref="table"
      rowKey="id"
      size="middle"
      :columns="columns"
      :dataSource="gDataSource"
      :pagination="gPagination"
      @change="gHandleTableChange"
    >
      <span
        slot="sortCol"
        slot-scope="text, record, index"
      >
        {{
          (gPagination.current - 1) * gPagination.pageSize + parseInt(index) + 1
        }}
      </span>
    </a-table>
  </div>
</template>

<script>
  import { GwListMixin } from "@/mixins/GwListMixin";
  import { gPostAction } from "@/api/manage";

  export default {
    name: 'Dispatch',
    mixins: [GwListMixin],
    data() {
      return {
        // 表头
        columns: [
        {
          title: "序号",
          dataIndex: "",
          key: "rowIndex",
          width: 50,
          scopedSlots: { customRender: "sortCol" },
        },
        {
          title: "应用名称",
          dataIndex: "appName",
        },
        {
          title: '云平台资源',
          dataIndex: 'cloudResourceName',
        },
        {
          title: "调度类型",
          dataIndex: "cloudResourceTypeName",
        },
        {
          title: "原数据中心",
          dataIndex: "srcDatacenterName",
        },
        {
          title: "目标数据中心",
          dataIndex: "dstDatacenterName",
        },
        {
          title: '调度结果',
          dataIndex: 'statusName',
        },
        {
          title: "结束时间",
          dataIndex: "beginTime",
        }, ],
        gDataSource: [],
        url: {
          list: "/scheduler/job/page",
        },
        form: {
          name: '',
        },
      };
    },
    mounted() {
      this.loadData();
    },
    methods: {
      loadData(isDoSearch) {
        this.gQueryParam.name = this.form.name
        this.gQueryParam.title = "多数据中心调度-动态调度机制-调度结果审计-调度日志记录";
        this.gQueryParam.content = "查询调度日志记录列表"
        if (isDoSearch) {
          this.gQueryParam.pageNo = 1
          this.gPagination.current = 1
        }
        gPostAction(this.url.list, this.gQueryParam).then((res) => {
          if (res.success) {
            this.gDataSource = res.data.list
            this.gPagination.total = res.data.totalCount
          }
        })
      },
    }
  }
</script>

<style
  lang="less"
  scoped
>
  .wrap {
    padding: 15px 20px;
  }

  .col-title {
    display: flex;
    align-items: center;
    font-size: 16px;
    color: #017972;
    padding-left: 10px;
    margin-bottom: 20px;

    &::before {
      content: '';
      height: 16px;
      display: inline-block;
      border-left: 2px solid #017972;
      padding-right: 10px;
    }
  }
</style>